﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Music.Utility.CustomExceptions
{
    /// <summary>
    /// EntityNotFoundException
    /// </summary>
    public class EntityNotFoundException : Exception
    {
        /// <summary>
        /// EntityType
        /// </summary>
        public Type EntityType { get; set; }

        /// <summary>
        /// Id
        /// </summary>
        public object Id { get; set; }

        /// <summary>
        /// EntityNotFoundException
        /// </summary>
        /// <param name="entityType"></param>
        /// <param name="id"></param>
        public EntityNotFoundException(Type entityType, object id)
            : this(entityType, id, null)
        {
        }

        /// <summary>
        /// EntityNotFoundException
        /// </summary>
        /// <param name="entityType"></param>
        /// <param name="id"></param>
        /// <param name="innerException"></param>
        public EntityNotFoundException(Type entityType, object id, Exception innerException)
            : base($"找不到该实体。实体类型: {entityType.FullName}, id: {id}", innerException)
        {
            EntityType = entityType;
            Id = id;
        }
    }
}